﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace DeZhen.DataCollection.IRepository
{
    public interface IBaseRepository<TEntity> where TEntity : class, new()
    {
        Task<TEntity> GetByIdAsync(long id);
        Task<List<TEntity>> GetListAsync();
        Task<List<TEntity>> GetListAsync(Expression<Func<TEntity, bool>> whereExpression);
        Task<List<TEntity>> GetPagedListAsync(Expression<Func<TEntity, bool>> predicate, int page, int pageSize);
        Task<bool> CreateAsync(TEntity entity);
        Task<long> CreateReturnIDAsync(TEntity entity);
        Task<bool> CreateManyAsync(List<TEntity> entityList);
        Task<bool> UpdateAsync(TEntity entity);
        Task DeleteAsync(long id);
        Task<bool> DeleteManyAsync(List<TEntity> entityList);
    }
}
